﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CNShapes;
using System.Drawing;

namespace CNPageViewer
{
    /// <summary>
    /// Renders a box-shape.
    /// </summary>
    public class ShapeRenderer_Box : IShapeRenderer
    {
        #region Public methods

        /// <summary>
        /// Renders the box shape onto the graphics surface passed in.
        /// </summary>
        public void renderShape(Shape shape, Graphics graphics, PageViewerControl pageViewerControl)
        {
            // We get the pen...
            Shape_Box boxShape = (Shape_Box)shape;
            Pen pen = RendererHelper.getPen(boxShape, pageViewerControl);

            // We convert the box's coordinates to screen coords, and draw it...
            RectangleF clientBoxBounds = RendererHelper.getBoundsInClientCoordinates(boxShape, pageViewerControl);
            graphics.DrawRectangle(pen, clientBoxBounds.X, clientBoxBounds.Y, clientBoxBounds.Width, clientBoxBounds.Height);
        }

        /// <summary>
        /// Returns the type of the shape we're managing (i.e. BoxShape)
        /// </summary>
        public Type getShapeType()
        {
            return typeof(Shape_Box);
        }

        #endregion

    }
}
